package net.lzzy.entity;

import net.lzzy.mapper.CommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CommentController {

    @Autowired
    private CommentMapper commentMapper;

    @GetMapping("/findall")
    public String findAll() {
        List<Comment> commentList= commentMapper.findAll();
        return commentList.toString();
    }

    @GetMapping("/page/{pagenum}/{pagesize}")
    public String pageFind(@PathVariable("pagenum") int pageNum, @PathVariable("pagesize") int pageSize) {
        List<Comment> commentList = commentMapper.pageFind1((pageNum-1)*pageSize, pageSize);
        return commentList.toString();
    }
}
